package com.bruce.learnrecylerview.app.dagger;

import android.content.Context;
import android.net.wifi.WifiManager;
import android.view.LayoutInflater;
import com.bruce.learnrecylerview.app.base.BaseApplication;
import com.github.bluzwang.fluxsupportkotlin.Dispatcher;
import dagger.Module;
import dagger.Provides;
import org.simple.eventbus.EventBus;

import javax.inject.Singleton;

/**
 * Created by wangzhijie@wind-mobi.com on 2015/9/1.
 */
@Module
public class Provider {

    @Singleton
    @Provides
    public EventBus provideEventBus() {
        return EventBus.getDefault();
    }
    @Singleton
    @Provides
    public de.greenrobot.event.EventBus provideOldEventBus() {
        return de.greenrobot.event.EventBus.getDefault();
    }

    @Singleton
    @Provides
    public Context provideContext() {
        return BaseApplication.getContext();
    }

    @Singleton
    @Provides
    public LayoutInflater provideInflater(Context context) {
        return LayoutInflater.from(context);
    }

    @Singleton
    @Provides
    public WifiManager provideWifiManager(Context context) {
        return (WifiManager) context.getSystemService(Context.WIFI_SERVICE);
    }

    @Singleton
    @Provides
    public Dispatcher provideDispatcher(EventBus bus) {
        return new Dispatcher(bus);
    }


    @Singleton
    @Provides
    public com.github.bluzwang.fluxsupport.Dispatcher provideDispatcher2(de.greenrobot.event.EventBus bus) {
        return new com.github.bluzwang.fluxsupport.Dispatcher(bus);
    }
}
